package xiecheng;

import java.util.Scanner;

/**
 * @author Hang
 * @date 2022/8/30
 * @project AutumnOffer
 * @description
 **/
public class Solution2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] in = new int[n][3];
        for(int i=0;i<n;i++){
            for(int j=0;j<3;j++){
                in[i][j] = sc.nextInt();
            }
        }
        int max1 = 0,max2 = 0,max3 = 0;
        for(int i=0;i<n;i++){
            if(in[i][0] == in[i][1]&&in[i][0]==in[i][2]){
                max1 = in[i][0] * 2;
            }else if((in[i][1]<in[i][0]&&in[i][1]<in[i][2]))
            {
                max2 = (Math.min(Math.min(in[i][0],in[i][1]),in[i][2])+1)*2;
            }else{
                int min = Math.min(Math.min(in[i][0],in[i][1]),in[i][2]);
                max3 = min * 2 + (in[i][1]-min-1);
            }
            System.out.println(Math.max(Math.max(max1,max2),max3));
        }

    }
}
